package CCRMClient.GUI;

import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

import java.awt.Font;

import javax.swing.JButton;

import CCRMClient.ClientStart;
import Common.SERVER_COMMANDS;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.IOException;
import javax.swing.border.LineBorder;
import java.awt.Color;
import org.eclipse.wb.swing.FocusTraversalOnArray;
import java.awt.Component;

/**
 * This class implements Management Department screen
 * @author Ori Ziv
 *
 */
public class MarketingScreen extends JPanel {
	private JLabel lblMarketingDepartment;
	private JButton btnMarketingManagement;
	private JButton btnGoBack;
	private JButton btnCatalog;
	private JButton btnTemplate;
	public MarketingScreen() {
		setBackground(Color.WHITE);
		setBorder(new LineBorder(new Color(0, 0, 0)));
		initComponents();
	}
	private void initComponents() {
		setLayout(null);
		setSize (450, 349);
		lblMarketingDepartment = new JLabel("Marketing Department");
		lblMarketingDepartment.setForeground(Color.RED);
		lblMarketingDepartment.setFont(new Font("David", Font.BOLD, 26));
		lblMarketingDepartment.setHorizontalAlignment(SwingConstants.CENTER);
		lblMarketingDepartment.setBounds(0, 11, 450, 27);
		add(lblMarketingDepartment);
		
		btnMarketingManagement = new JButton("Marketing Management");
		btnMarketingManagement.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				ClientStart.panelSwicher(new MarketingManagementScreen());
			}
		});
		btnMarketingManagement.setFont(new Font("Tahoma", Font.BOLD, 16));
		btnMarketingManagement.setBounds(96, 65, 261, 23);
		add(btnMarketingManagement);
		
		btnGoBack = new JButton("Go Back");
		btnGoBack.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ClientStart.panelSwicher(new EmployeePortal());
			}

		});
		btnGoBack.setFont(new Font("Tahoma", Font.BOLD, 12));
		btnGoBack.setBounds(161, 252, 124, 23);
		add(btnGoBack);
		
		btnCatalog = new JButton("Catalog");
		btnCatalog.addActionListener(new BtnCatalogActionListener());
		btnCatalog.setFont(new Font("Tahoma", Font.BOLD, 16));
		btnCatalog.setBounds(96, 99, 261, 23);
		add(btnCatalog);
		
		/**
		 * Creates Templates button
		 * @author AL
		 */
		btnTemplate = new JButton("Templates");
		btnTemplate.addActionListener(new BtnTemplateActionListener());
		btnTemplate.setFont(new Font("Tahoma", Font.BOLD, 16));
		btnTemplate.setBounds(96, 133, 261, 23);
		add(btnTemplate);
		setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{btnMarketingManagement, btnCatalog, btnTemplate, btnGoBack}));
	}
	private class BtnCatalogActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			ClientStart.panelSwicher(new CatalogScreen());
		}
	}
	
	/**
	 * This inner class implements event listener for pressing Template button
	 * @author AL
	 */
	private class BtnTemplateActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			ClientStart.panelSwicher(new TemplateManagementScreen());
		}
	}
}
